|
|
 |
|
|
|
|
' palette as picHidden. picVisible.Picture = picHidden.Picture
picSwatch. Picture = picHidden. Picture
LogicalPalette = picHidden.Picture.hPal
' Draw the image at the correct scale. DrawImage
' Make sure picVisible has the foreground palette. RealizePalette picVisible.hdc
' Give the system a chance to catch up. DoEvents
' Make the logical palette as big as possible. If ResizePalette(LogicalPalette, SysPalSize) = 0 Then
MsgBox "Error resizing logical palette."
Exit Sub
End If
' Get the system palette entries. GetSystemPaletteEntries picHidden.hdc, 0, _
SysPalSize, palentry(0)
' Blank the non-static colors. For i = 0 To StaticColor1
blanked(i) = palentry(i)
blanked(i).peFlags = PC_NOCOLLAPSE
Next i
For i = StaticColor1 + 1 To StaticColor2 - 1
With blanked(i)
.peRed = i
.peGreen = 0
.peBlue = 0
.peFlags = PC_NOCOLLAPSE
End With
Next i
For i = StaticColor2 To 255
blanked(i) = palentry(i)
blanked(i).peFlags = PC_NOCOLLAPSE
Next i
SetPaletteEntries LogicalPalette, 0, _
SysPalSize, blanked(0)
' Insert the non-static colors. For i = StaticColor1 + 1 To StaticColor2 - 1
palentry(i).peFlags = PC_NOCOLLAPSE
Next i
SetPaletteEntries LogicalPalette, StaticColor1 + 1, _
StaticColor2 - StaticColor1 - 1, _
palentry(StaticColor1 + 1) |
|
|
|
|
|